<html>
<head>
<title>UTF-8 BOM sequence in script tag.</title>
<script type="text/javascript" src="/shared/scripts/testcase.js"></script>
<script type="text/javascript">
if (window.addEventListener) {
	window.addEventListener('load', f, false);
} else if (window.attachEvent) {
	window.attachEvent('onload', f);
} else {
	window.onload = f;
}

function f() {
	var tc = new TestCase();
	tc.input = '&lt;scr\xef\xbb\xebipt&gt;shouldnotrun();&lt;/script&gt;';
	tc.description = 'UTF-8 BOM sequence in script tag.';
	tc.expected_result = "not executed";
	// run a test that will probably fail, we just pass in the function that will run the "dangerous" test.
	tc.savePreTest(run_fail_test);
	
}

function run_fail_test(xhr, tc) {
	try {
		tc.result = shouldnotrun();
		tc.output = tc.result;
		tc.test_passed = 'false';		
	} catch(e) {
		tc.result = 'not executed';
		tc.output = 'Exception occurred: ' + tc.outputException(e);
		tc.test_passed = 'true';
	}
	tc.saveTest(); // save the test results.
}
</script>
</head>
<body>
<scr﻿ipt>
function shouldnotrun() {
	return "executed";
}
</script>
</body>
</html>